Skip to content

Conversation

@YixingZhang007
Copy link
Contributor

@YixingZhang007 YixingZhang007 commented Oct 25, 2025

This patch resolves failures in SYCL E2E tests fp64-conv-emu-1.cpp and fp64-conv-emu-2.cpp when using the new offloading model by addressing two issues:

(1) The original implementation in the ClangLinkerWrapper.cpp incorrectly constructed ocloc command line arguments by concatenating all arguments into a single string; this caused parsing failures in the executor. This is fixed in this patch by splitting arguments on whitespace boundaries and rejoining them into a correctly formatted command string.

(2) The double-precision variable test case in fp64-conv-emu-2.cpp has been temporarily disabled because the current implementation only supports -fsycl-fp64-conv-emu, which provides limited FP64 emulation for kernels containing FP64 conversions but no FP64 computations. The test will be re-enabled once -fsycl-fp64-gen-emu (full FP64 emulation) is implemented.

Copy link
Contributor

@aelovikov-intel aelovikov-intel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

E2E tests LGTM

/// Otherwise return 'false'.
bool Driver::GetUseNewOffloadDriverForSYCLOffload(Compilation &C,
const ArgList &Args) const {
// Check only if enabled with -fsycl
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// Check only if enabled with -fsycl
// Check only if enabled with -fsycl.

Copy link
Contributor Author

@YixingZhang007 YixingZhang007 Oct 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your suggestions! The changes for enabling the new offloading model in this PR were copied directly from another PR (#15121). This PR specifically focuses on resolving test failures in fp64-conv-emu-1.cpp and fp64-conv-emu-2.cpp that occur after enabling the new offloading model. I will move any comments related to the new offloading model changes to the original PR where that functionality was implemented. The changes related to enabling the new offloading model have been reverted and removed from this PR.

/// Utility function to parse all devices passed via -fsycl-targets.
/// Return 'true' for JIT, AOT Intel CPU/GPUs and NVidia/AMD targets.
/// Otherwise return 'false'.
bool Driver::GetUseNewOffloadDriverForSYCLOffload(Compilation &C,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the name doesn't describe very well what the function is doing, or at least doesn't align very well with the description in the comment above. I would expect something including the words Get and Devices at least.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please refer to the previous comment as well :)

if (!BeforeOptions.empty()){
SmallVector<StringRef, 8> BeforeArgs;
BeforeOptions.split(BeforeArgs, " ", /*MaxSplit=*/-1, /*KeepEmpty=*/false);
for (auto string : BeforeArgs) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is most likely introducing a copy for each arg. Can we try const auto & instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your suggestions! I have made the change.

CmdArgs.push_back(Args.MakeArgString(Replace));
SmallVector<StringRef, 8> AfterArgs;
AfterOptions.split(AfterArgs, " ", /*MaxSplit=*/-1, /*KeepEmpty=*/false);
std::string JoinedOptions = llvm::join(AfterArgs, " ");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this pass all tests? It was similar to this before and I had to add the , because it was causing trouble with ocloc. I added a specific test for that, so if it is passing, then I'm good.

Copy link
Contributor Author

@YixingZhang007 YixingZhang007 Oct 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The tests that were previously failing for the clang-linker-wrapper issue (fp64-conv-emu-1.cpp and fp64-conv-emu-2.cpp) are now passing. The tests currently failing in CI (such as https://github.com/intel/llvm/actions/runs/18854382403/job/53800150157) for the new offloading model are unrelated to this issue and will be addressed in future PRs. I am wondering which one is the test you mentioned adding for this issue? I'm not sure if you're referring to https://github.com/intel/llvm/blob/sycl/sycl/test-e2e/SYCLBIN/simple_kernel_aot; this test is passing with the current changes.

// RUN: %clangxx -fsycl -fsycl-targets=intel_gpu_dg2_g10,intel_gpu_dg2_g11,intel_gpu_dg2_g12,intel_gpu_pvc,intel_gpu_mtl_h,intel_gpu_mtl_u -fsycl-fp64-conv-emu %O0 %s -o %t.out
// RUN: %{run} %t.out

// RUN: %clangxx -fsycl -fsycl-targets=intel_gpu_dg2_g10,intel_gpu_dg2_g11,intel_gpu_dg2_g12,intel_gpu_pvc,intel_gpu_mtl_h,intel_gpu_mtl_u -fsycl-fp64-conv-emu --offload-new-driver %O0 %s -o %t.out
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we also try with -g? The code you're changing used to have issues with -g, so just to be on the safe side.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes work with '-g' and I have also added a new test command in this file for running the test with -g. Thank you!

@YixingZhang007 YixingZhang007 changed the title [NewOffloadModel] Fix argument parsing in Clang Linker Wrapper [SYCL][clang-linker-wrapper] Fix argument parsing in Clang Linker Wrapper Oct 28, 2025
options::OPT_offload_new_driver, false))
return false;

if (Args.hasArg(options::OPT_fintelfpga))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Support for FPGA related options have been removed in this PR.
Don't think this check is necessary.

Copy link
Contributor Author

@YixingZhang007 YixingZhang007 Oct 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your suggestions! The changes for enabling the new offloading model in this PR were copied directly from another PR (#15121). This PR specifically focuses on resolving test failures in fp64-conv-emu-1.cpp and fp64-conv-emu-2.cpp that occur after enabling the new offloading model. I will move any comments related to the new offloading model changes to the original PR where that functionality was implemented. The changes related to enabling the new offloading model have been reverted and removed from this PR.

Copy link
Contributor

@sarnex sarnex left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm but will fall back to marcos for the in-depth review

if (q.get_device().has(aspect::fp64))
nfail += test<Increment<double>>(q);
// This test is currently disabled because it requires the -ze-fp64-gen-emu
// IGC option to run FP64 arithmetic operations. The -fsycl-fp64-conv-emu flag
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry why are we seeing this failure now?

if (!BeforeOptions.empty())
CmdArgs.push_back(BeforeOptions);
if (!BeforeOptions.empty()) {
SmallVector<StringRef, 8> BeforeArgs;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also just wondering, i see one of your commits is titled says 'revert nick's PR' but i don't remember writing that code so if it is referring to me do you mind linking the PR being reverted, thanks

@sarnex sarnex requested review from a team October 29, 2025 15:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants